from matplotlib import pyplot as plt
import pandas as pd
import numpy as np
import matplotlib


#// 1. 中文显示
plt.rcParams['font.sans-serif']=['SimHei'] #用来正常显示中文标签


#// 2. 读数据
#! 修改项
# path = r"C:\Users\lainiao\Desktop\a.xlsx"
# data = pd.read_excel(path)
# print(data)





#// 3. 显示布局（标题、标签、数据）
#! 修改项
# plt.title("第 1 重要属性")
# plt.ylabel("$\\alpha$")
# x = ["", "\n", " ", " \n", "  ", "RM", "  \n", "    ", "    \n", "   ", "     ", "   \n", "     \n"]
# x = ['CRIM','ZN','INDUS','CHAS','NOX','RM','AGE','DIS','RAD','TAX','PIRARTIO','B','LSTAT']
# y = [0.528769427,0.494395039,0.506152522,0.562095557,0.539563624,0.361167034,0.546213205,0.489843075,0.423255877,0.554175451,0.452119504,0.605023188,0.437226497]

#! 修改项
# plt.title("第 2 重要属性")
# plt.ylabel("$\\alpha$")
# x = ["", "\n", " ", " \n", "  ", "  \n", "    ", "    \n", "   ", "     ", "   \n", "LSTAT"]
# x = ['CRIM','ZN','INDUS','CHAS','NOX','AGE','DIS','RAD','TAX','PIRARTIO','B','LSTAT']
# y = [0.51126937,0.574339947,0.526295168,0.464967946,0.547022847,0.551728683,0.407018902,0.438315882,0.590807223,0.505109459,0.521174356,0.361950218]

#! 修改项
# plt.title("第 3 重要属性")
# plt.ylabel("$\\alpha$")
# x = ["", "\n", " ", " \n", "  ", "  \n", "DIS", "    \n", "   ", "     ", "   \n"]
# x = ['CRIM','ZN','INDUS','CHAS','NOX','AGE','DIS','RAD','TAX','PIRARTIO','B']
# y = [0.509047793,0.549749964,0.610189392,0.552557835,0.445237451,0.551497295,0.387506669,0.395598113,0.522918883,0.430948464,0.54474814]

#! 修改项
# plt.title("第 4 重要属性")
# plt.ylabel("$\\alpha$")
# x = ["", "\n", " ", " \n", "  ", "  \n", "RAD", "   ", "     ", "   \n"]
# x = ['CRIM','ZN','INDUS','CHAS','NOX','AGE','RAD','TAX','PIRARTIO','B']
# y = [0.620760115,0.557086664,0.459322218,0.424672593,0.524803657,0.461079827,0.383376534,0.571793028,0.427278044,0.56982732]

#! 修改项
# plt.title("第 5 重要属性")
# plt.ylabel("$\\alpha$")
# x = ["", "\n", " ", "  \n", "    ", "    \n", "   ", "RIRATIO", "   \n"]
# x = ['CRIM','ZN','INDUS','CHAS','NOX','AGE','TAX','PIRARTIO','B']
# y = [0.497768271,0.54165454,0.501098163,0.607033034,0.441196311,0.504916236,0.440207106,0.355645086,0.610481254]

#! 修改项
# plt.title("人工数据集") #! 标题
plt.ylabel("$\delta$")   #! 纵轴标签
x_label = ["$x_1$","$x_2$","$x_3$","$x_4$"] #! 横轴标签
y1 = [0.797564747,0.758924599,0.036048599,0.009128515]
y2 = [0.040178806,0.036378464,0.019017587,0.007496487]


#// 4. 画图
#! 修改项
plt.plot(x_label,y1,'o-',label='$Q_1$')
plt.plot(x_label,y2,'o-',label='$Q_3$')
# plt.plot(x,y,'o-')
plt.legend() # 添加图例
# plt.grid() # 添加网格
# plt.xticks(rotation=17)
plt.show()